<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>computed</title>
  <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script>
</head>
<body>
  <h1>computed</h1>
  <hr>
  <div id="app">
    <p>{{newPrice}}</p>
    <hr>
    <ul>
      <li v-for="(item,index) in reverseList">{{index}}、{{item.title}}-{{item.date}}</li>
    </ul>
  </div>
  <script type="text/javascript">
  var newsList=[
    {title:'印度单日新增新冠病例再创新高1',date:'2021/04/28'},
    {title:'印度单日新增新冠病例再创新高2',date:'2021/04/29'},
    {title:'印度单日新增新冠病例再创新高3',date:'2021/04/29'},
    {title:'印度单日新增新冠病例再创新高4',date:'2021/04/27'},
    {title:'印度单日新增新冠病例再创新高5',date:'2021/04/30'},
  ]
  var app = new Vue({
    el:'#app',
    data:{
      price:100,
      newsList:newsList
    },
    computed:{
      newPrice:function(){
        return '￥'+this.price+'元';
      },
      reverseList:function(){
        return this.newsList.reverse();
      }
    }
  })
  </script>
</body>
</html>